package vista;
import java.awt.BorderLayout;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;

import javax.swing.WindowConstants;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import javax.swing.SwingUtilities;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class VentanaListadoDespachosCliente extends javax.swing.JFrame {

	{
		//Set Look & Feel
		try {
			javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());
		} catch(Exception e) {
			e.printStackTrace();
		}
	}

	private JPanel panListadoDespachosCliente;
	private JLabel lblCedula;
	private JLabel lblNombre;
	private JTextField txtCedula;
	private JTextField txtNombre;
	private JButton btmCancelar;
	private JButton btnSalir;
	private JTable tblListadoDespachoClientes;
	private JScrollPane jsListadoDespachoCliente;
	private JButton btnCrearReporte;

	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				VentanaListadoDespachosCliente inst = new VentanaListadoDespachosCliente();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public VentanaListadoDespachosCliente() {
		super();
		initGUI();
	}
	
	public void agregarListener(ActionListener accion){
		btnCrearReporte.addActionListener(accion);
		btnSalir.addActionListener(accion);
		btmCancelar.addActionListener(accion);
	}
	
	public void setCedula(String ced){
		txtCedula.setText(ced);
	}
	
	public String getCedula(){
		return txtCedula.getText();
	}
	
	public void setNombre(String nom){
		txtNombre.setText(nom);
	}
	
	public String getNombre(){
		return txtNombre.getText();
	}
	
	public void setListado(AbstractTableModel abstractTableModel){
		tblListadoDespachoClientes.setModel(abstractTableModel);
	}
	
	public void limpiar() {
		
		this.txtCedula.setText("");
		this.txtNombre.setText("");
		
	}
	
	
	public void mostrarMensaje(String mensaje) {
		JOptionPane.showMessageDialog(this, mensaje);
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			{
				panListadoDespachosCliente = new JPanel();
				getContentPane().add(panListadoDespachosCliente, BorderLayout.CENTER);
				panListadoDespachosCliente.setLayout(null);
				panListadoDespachosCliente.setBounds(0, 0, 577, 375);
				panListadoDespachosCliente.setPreferredSize(new java.awt.Dimension(577, 410));
				{
					lblCedula = new JLabel();
					panListadoDespachosCliente.add(lblCedula);
					lblCedula.setText("Cedula:");
					lblCedula.setBounds(57, 34, 61, 15);
				}
				{
					lblNombre = new JLabel();
					panListadoDespachosCliente.add(lblNombre);
					lblNombre.setText("Nombre del Cliente:");
					lblNombre.setBounds(57, 75, 141, 15);
				}
				{
					txtCedula = new JTextField();
					panListadoDespachosCliente.add(txtCedula);
					txtCedula.setBounds(205, 30, 98, 24);
				}
				{
					txtNombre = new JTextField();
					panListadoDespachosCliente.add(txtNombre);
					txtNombre.setBounds(205, 71, 199, 25);
				}
				{
					btnCrearReporte = new JButton();
					panListadoDespachosCliente.add(btnCrearReporte);
					btnCrearReporte.setText("Crear Reporte");
					btnCrearReporte.setBounds(412, 39, 111, 29);
				}
				{
					jsListadoDespachoCliente = new JScrollPane();
					panListadoDespachosCliente.add(jsListadoDespachoCliente);
					jsListadoDespachoCliente.setBounds(38, 155, 496, 157);
					{
						TableModel tblListadoDespachoClientesModel = 
								new DefaultTableModel(
										new String[][] { { "", "", "", "", "" }, { "", "", "", "", "" } },
										new String[] { "", "", "", "", "" });
						tblListadoDespachoClientes = new JTable();
						jsListadoDespachoCliente.setViewportView(tblListadoDespachoClientes);
						tblListadoDespachoClientes.setModel(tblListadoDespachoClientesModel);
					}
				}
				{
					btnSalir = new JButton();
					panListadoDespachosCliente.add(btnSalir);
					btnSalir.setText("Salir");
					btnSalir.setBounds(435, 342, 68, 29);
				}
				{
					btmCancelar = new JButton();
					panListadoDespachosCliente.add(btmCancelar);
					btmCancelar.setText("Cancelar");
					btmCancelar.setBounds(324, 342, 74, 29);
				}
			}
			pack();
			this.setSize(579, 433);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}



}
